home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / machine / starwars.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  2KB  |  89 lines

  1. /***************************************************************************
  2. machine\starwars.c
  3.  
  4. STARWARS MACHINE FILE
  5.  
  6. This file is Copyright 1997, Steve Baines.
  7. Modified by Frank Palazzolo for sound support
  8.  
  9. Release 2.0 (6 August 1997)
  10.  
  11. See drivers\starwars.c for notes
  12.  
  13. ***************************************************************************/
  14.  
  15. #include "driver.h"
  16. #include "cpuintrf.h"
  17. #include "swmathbx.h"
  18. #include "vidhrdw/avgdvg.h"
  19.  
  20.  
  21. /* control select values for ADC_R */
  22. #define kPitch    0
  23. #define kYaw    1
  24. #define kThrust    2
  25.  
  26. static unsigned char control_num = kPitch;
  27.  
  28. #if 0
  29. /********************************************************/
  30. READ_HANDLER( input_bank_0_r )
  31. {
  32.     int x;
  33.     x=input_port_0_r(0); /* Read memory mapped port 1 */
  34.     x=x&0xdf; /* Clear out bit 5 (SPARE 1) */
  35. #if(MACHDEBUG==1)
  36.     printf("(%x)input_bank_0_r   (returning %xh)\n", cpu_get_pc(), x);
  37. #endif
  38.     return x;
  39. }
  40. #endif
  41.  
  42. /********************************************************/
  43. READ_HANDLER( starwars_input_bank_1_r )
  44. {
  45.     int x;
  46.     x=input_port_1_r(0); /* Read memory mapped port 2 */
  47.  
  48. #if 0
  49.     x=x&0x34; /* Clear out bit 3 (SPARE 2), and 0 and 1 (UNUSED) */
  50.     /* MATH_RUN (bit 7) set to 0 */
  51.     x=x|(0x40);  /* Set bit 6 to 1 (VGHALT) */
  52. #endif
  53.  
  54.     /* Kludge to enable Starwars Mathbox Self-test                  */
  55.     /* The mathbox looks like it's running, from this address... :) */
  56.     if (cpu_get_pc() == 0xf978)
  57.         x|=0x80;
  58.  
  59.     /* Kludge to enable Empire Mathbox Self-test                  */
  60.     /* The mathbox looks like it's running, from this address... :) */
  61.     if (cpu_get_pc() == 0xf655)
  62.         x|=0x80;
  63.  
  64.     if (avgdvg_done())
  65.         x|=0x40;
  66.     else
  67.         x&=~0x40;
  68.  
  69.     return x;
  70. }
  71. /*********************************************************/
  72. /********************************************************/
  73. READ_HANDLER( starwars_control_r )
  74. {
  75.  
  76.     if (control_num == kPitch)
  77.         return readinputport (4);
  78.     else if (control_num == kYaw)
  79.         return readinputport (5);
  80.     /* default to unused thrust */
  81.     else return 0;
  82. }
  83.  
  84. WRITE_HANDLER( starwars_control_w )
  85. {
  86.     control_num = offset;
  87. }
  88.  
  89.